//===============================================================================
// Microsoft Architecture Strategy Team
// LitwareHR - SaaS Sample Application
//===============================================================================
// Copyright  Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================



using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
using Shp.Runtime.Contract;
using System.Collections.ObjectModel;

namespace LitwareHR.Recruiting.Contract
{
    public enum VideoUploadState 
    {
        Available   = 0,
        NoExists    = 1,
        Uploading   = 2,
        Error       = 3
    }

    [DataContract, Serializable]
    public class Resume
    {
        private string objectives;

        //This is for keep old integration
        public string Objectives 
        {
            get
            {
                return objectives;
            }
            set
            {
                objectives = value;
            }
        }

        private string interests;
        //This is for keep old integration
        public string Interests 
        {
            get
            {
                return interests;
            }
            set
            {
                interests = value;
            }
        }

        private Guid id;
        [DataMember]
        public Guid Id 
        {
            get
            {
                return id;
            }
            set
            {
                id = value;
            }
        }

        private Guid positionId;
        [DataMember]
        public Guid PositionId 
        {
            get
            {
                return positionId;
            }
            set
            {
                positionId = value;
            }
        }

        private Upn upn;
        [DataMember]
        public Upn Upn 
        {
            get
            {
                return upn;
            }
            set
            {
                upn = value;
            }
        }

        private String applicantName;
        [DataMember]
        public String ApplicantName 
        {
            get
            {
                return applicantName;
            }
            set
            {
                applicantName = value;
            }
        }

        private String applicantLastName;
        [DataMember]
        public String ApplicantLastName 
        {
            get
            {
                return applicantLastName;
            }
            set
            {
                applicantLastName = value;
            }
        }

        private String address;
        [DataMember]
        public String Address 
        {
            get
            {
                return address;
            }
            set
            {
                address = value;
            }
        }

        private String phoneNumber;
        [DataMember]
        public String PhoneNumber 
        {
            get
            {
                return phoneNumber;
            }
            set
            {
                phoneNumber = value;
            }
        }

        private DateTime date;
        [DataMember]
        public DateTime Date 
        {
            get
            {
                return date;
            }
            set
            {
                date = value;
            }
        }

        private String additionalInfo;
        [DataMember]
        public String AdditionalInfo 
        {
            get
            {
                return additionalInfo;
            }
            set
            {
                additionalInfo = value;
            }
        }

        private bool isVideoAvailable;
        [DataMember]
        public bool IsVideoAvailable 
        {
            get
            {
                return isVideoAvailable;
            }
            set
            {
                isVideoAvailable = value;
            }
        }

        private byte[] videoResume;
        [DataMember]
        public byte[] VideoResume 
        {
            get
            {
                return videoResume;
            }
            set
            {
                videoResume = value;
            }
        }

        private bool isVideoUploaded;
        [DataMember]
        public bool IsVideoUploaded 
        {
            get
            {
                return isVideoUploaded;
            }
            set
            {
                isVideoUploaded = value;
            }
        }

        private Collection<Field> fields;
        [DataMember]
        public Collection<Field> Fields 
        {
            get
            {
                return fields;
            }
            private set
            {
                fields = value;
            }
        }
        
        public VideoUploadState VideoUploadState
        {
            get
            {
                if (IsVideoAvailable && IsVideoUploaded)
                {
                    return VideoUploadState.Available;
                }
                else if (!IsVideoAvailable && !IsVideoUploaded)
                {
                    return VideoUploadState.NoExists;
                }
                else if (!IsVideoAvailable && IsVideoUploaded)
                {
                    return VideoUploadState.Uploading;
                }
                return VideoUploadState.Error;
            }
        }
                
        public Resume()
        {
            Id = Guid.NewGuid();            
            VideoResume = null;
            Fields = new Collection<Field>();
        }
    }
}
